package org.cloud.scheduler.controller;

import java.util.Map;

import org.cloud.common.model.R;
import org.cloud.module.common.entity.ScheduleJobLogEntity;
import org.cloud.module.common.util.PageUtils;
import org.cloud.scheduler.service.ScheduleJobLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 定时任务日志
 * @author wangyuan
 * @since 2019年6月15日 下午10:52:47
 *
 */
@RestController
@RequestMapping("/jobLog")
public class ScheduleJobLogController {
	
	@Autowired
	private ScheduleJobLogService scheduleJobLogService;
	
	/**
	 * 定时任务日志列表
	 */
	@RequestMapping("/list")
	public R list(@RequestParam Map<String, Object> params){
		PageUtils page = scheduleJobLogService.queryPage(params);
		
		return R.ok().put("page", page);
	}
	
	/**
	 * 定时任务日志信息
	 */
	@RequestMapping("/info/{logId}")
	public R info(@PathVariable("logId") Long logId){
		ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);
		
		return R.ok().put("log", log);
	}
}
